@extends('layouts.app')
@include('free.sidebar')
@section('content')
    <div class="content">
        <div class="row custom-invoice">
            <form class="form form-inline" method="get" action="{{ route('admin.free.good') }}">
                <div class="form-group">
                    <label for="type">商品种类：</label>
                    <select name="type" class="form form-control">
                        <option value = "package" {{ $type == "package"? "selected":"" }}>套系商品</option>
                        <option value = "good" {{ $type == "good"? "selected":"" }}>普通商品</option>
                    </select>
                </div>
                <button type="submit" class="form-control btn btn-success">查找</button>
            </form>
            <br />
            <table class="table table-striped table-hover">
                <thead>
                <tr>
                    <th>所属门店</th>
                    <th>类别</th>
                    <th>商品名</th>
                    <th>价格</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                @foreach($data as $item)
                    <tr>
                        <td>{{ $shop->get($item->shop_id)->name }}</td>
                        <td>{{ $item->category }}</td>
                        <td>{{ $item->name }}</td>
                        <td>{{ $item->price/100}}</td>
                        <td>
                            <a class="btn btn-primary btn-xs" href="{{ route('admin.free.good.cancel', ['id' => $item->id, 'type' => $type]) }}"><i class="fa fa-external-link"></i> 取消</a>
                            <a class="btn btn-primary btn-xs" href="{{ route('admin.free.unlock_good', ['id' => $item->id, 'type' => $type]) }}"><i class="fa fa-outdent"></i> 解锁商品列表</a>
                        </td>
                    </tr>
                @endforeach
                </tbody>
            </table>
            {{ $data->appends(['type' => $type])->links() }}
        </div>
    </div>
@endsection
